package com.ja.pulldown;


import com.ja.enumall.StatusEnum;
import com.ja.util.pojoenum.StatusDown;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * 单例模式的下拉列表的获取
 * Created by 11936 on 2019/4/25.
 */
public class GetPullDownList {
    private static HashMap<String, List> map;

    private GetPullDownList() {

    }

    public static HashMap<String, List> getGetPullDownList(){
        if(map == null){
            map = new HashMap<>();
        }
        addStatusEnum();
        return map;
    }

    public HashMap<String, List> getMap() {
        return map;
    }

    private static void addStatusEnum(){
        List<StatusDown> list = new ArrayList<>();
        for(int i = StatusEnum.values().length-1; i >= 0; i--){
            StatusDown statusDown = new StatusDown();
            statusDown.setLabel(StatusEnum.getStatusName(i));
            statusDown.setValue(i);
            list.add(statusDown);
        }
        map.put("[\"subClass.subClassStatus\"]",list);
    }
}
